<?php

namespace MyBlog\Models;

use Illuminate\Database\Eloquent\Model;

class Article extends Model
{
    protected $guarded = array('id');

    public function category() {
        return $this->belongsTo('MyBlog\Models\Category');
    }

    public function comments() {
        return $this->hasMany('MyBlog\Models\Comment');
    }

    public static $rules = [
        'category_id' => 'required',
        'title' => 'required',
    ];

    public static $msgs = [
        'category_id.required' => '分类名称不能为空',
        'title.required' => '标题不能为空',
    ];
}
